<?php
/**
 * Description of IndexComponent
 *
 * @author Animus Inc.
 */

// Restrict Unrestricted Access

defined("_dispatch") or	die("Access Denied !");

// Constants

define('DOMROOT', dirname(dirname(__FILE__)));

// Imports
require_once DOMROOT.'/classes/abstract/Component.php';

class IndexComponent extends Component{
    
    private $_model_view;
    private $_request;
    private $_response;
    
    public function execute(){
        $this -> service();
        return true;
    }
    
    public function service() {
       $this ->populateDefaultResponse();
    }
    
    public function populateSuccessResponse(){
        $this -> _response -> setValid();
        $this -> _response -> setView($this -> _model_view -> getSuccessView());
        $this -> _response -> setModel($this -> _model_view -> getModel());
        $this -> _response -> setSession($this -> _request -> getSession());
        return;
    }
    
    public function populateDefaultResponse(){
        $this -> _response -> setValid();
        $this -> _response -> setView($this -> _model_view -> getDefaultView());
        $this -> _response -> setModel($this -> _model_view -> getModel());
        $this -> _response -> setSession($this -> _request -> getSession());
        return;
    }
    
    // Getters and Setters
    
    public function setModelView(ModelView $_model_view){
        $this -> _model_view = $_model_view;
        return;
    }
    
    public function getModelView(){
        $this -> _model_view;
        return;
    }
    
    
    public function setRequest(AnimusRequest $Request){
        $this -> _request = $Request;
        return;
    }
    
    public function getRequest(){
        return $this -> _request;
    }
    
    public function setResponse(AnimusResponse $Response){
        $this -> _response = $Response;
        return;
    }
    
    public function getResponse(){
     return   $this ->_response;
    }
}
?>
